const mongoose = require("mongoose");

const Schema = mongoose.Schema

// comments  = {
//     A_username: 'A',
//     B_username: 'B',
//     content:'你在干嘛',
//     time:'2022/11/15'
// }

const articleSchema = new Schema({
    username: {
        type: String,
        require: true
    },
    time: {
        type: String,
        require: true
    },
    content: {
        type: String,
        require: true
    },
    type: {
        type: Array,
        require: true
    },
    title: {
        type: String,
        require: true
    },
    thumbCount: {
        type: Number,
        default: 0
    },
    browseCount: {
        type: Number,
        default: 1
    },
    comments: {
        type: Array,
        default: []
    }
}, {
    collection: 'article',
    versionKey: false
})

module.exports = mongoose.model('article', articleSchema)